﻿using System;
using System.Collections.Generic;
using SinBiota.Model.Business.PersistenceServices.Interfaces;
using SinBiota.Model.Entities;
using SinBiota.Model.Persistence.Repositories.Interfaces;

namespace SinBiota.Model.Business.PersistenceServices.Implementation
{
    public class MicroHabitatPersistenceServices : IMicroHabitatPersistenceServices
    {
        private readonly IMicroHabitatRepository _microHabitatRepository;

        public MicroHabitatPersistenceServices(IMicroHabitatRepository microHabitatRepository)
        {
            _microHabitatRepository = microHabitatRepository;
        }

        public MicroHabitat FindById(int id)
        {
            return _microHabitatRepository.FindById(id);
        }

        public MicroHabitat FindByName(string name)
        {
            return _microHabitatRepository.FindByName(name);
        }


        public IList<MicroHabitat> FindAll()
        {
            return _microHabitatRepository.FindAll();
        }

        public void Delete(MicroHabitat microHabitat)
        {
            _microHabitatRepository.Delete(microHabitat);
        }

        public void DeleteById(int id)
        {
            Delete(FindById(id));
        }
        public void Save(MicroHabitat microHabitat)
        {
            _microHabitatRepository.Save(microHabitat);
        }

        public void Update(MicroHabitat microHabitat)
        {
            _microHabitatRepository.Update(microHabitat);
        }

        public IList<MicroHabitat> FindByNameLike(string name)
        {
            return _microHabitatRepository.FindByNameLike(name);
        }
    }
}